Skip to content

autobahn mempool#3522

Open
pompon0 wants to merge 109 commits into
mainfrom
gprusak-mempool2
Open

autobahn mempool#3522
pompon0 wants to merge 109 commits into
mainfrom
gprusak-mempool2

Conversation

@pompon0
Copy link
Copy Markdown
Contributor

@pompon0 pompon0 commented May 29, 2026

Mempool constructed specifically for autobahn tx lifecycle:

  • mempool rejects pending (non-ready) rpcs
  • mempool insert rpcs are blocking if mempool is full
  • mempool capacity is counted in local lane blocks - it can contain up to types.BlocksPerLane blocks since the last locally executed lane block
  • in particular mempool tracks EVM nonces until the local block is locally executed, at which point it can confirm whether the account nonces have been bumped as expected.
  • blocks are pushed from mempool to lane in avail.State as soon as there is capacity in avail.State (which is different than mempool capacity, because mempool counts blocks wrt to local execution, while avail.State counts blocks wrt to global execution)
  • full local blocks are constructed as soon as there is enough txs in the mempool
  • smaller local blocks are constructed after a BlockInterval timeout
  • empty blocks are NOT constructed

@cursor
Copy link
Copy Markdown

cursor Bot commented May 29, 2026

PR Summary

High Risk
Changes the transaction admission and block-production path for Autobahn validators (blocking inserts, nonce rules, execution-synced pruning) and touches consensus/RPC wiring; mistakes can drop txs, stall lanes, or desync RPC from execution.

Overview
Autobahn replaces the shared CometBFT TxMempool with a producer-owned mempool wired through GigaRouter and RPC (InsertTx, broadcast/unconfirmed paths, EvmNextPendingNonce).

The new mempool buffers txs into lane blocks (count/byte/gas caps), blocks inserts when full, enforces EVM nonce order, and prunes after local lane execution via data.State.WaitUntilExecuted. producer.Run pushes sealed blocks into avail.State at explicit block numbers (no empty blocks; optional BlockInterval for partial blocks). Autobahn config drops mempool_size / allow_empty_blocks; Payload protobuf/types drop edge_count, coinbase, basefee. Non-giga nodes keep the legacy mempool; RPC Environment uses optional components and rejects unsafe_flush_mempool on Autobahn.

Reviewed by Cursor Bugbot for commit a081eb7. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 29, 2026

The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedMay 29, 2026, 7:18 PM

Comment thread sei-tendermint/internal/autobahn/producer/state.go Outdated
Comment thread sei-tendermint/internal/autobahn/producer/mempool.go
Comment thread sei-tendermint/internal/autobahn/producer/state.go
Comment thread sei-tendermint/node/setup.go
Comment thread sei-tendermint/internal/autobahn/producer/state.go
@codecov
Copy link
Copy Markdown

codecov Bot commented May 29, 2026

Codecov Report

❌ Patch coverage is 59.13978% with 190 lines in your changes missing coverage. Please review.
✅ Project coverage is 58.16%. Comparing base (c4e1a2a) to head (a081eb7).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
sei-tendermint/internal/rpc/core/mempool.go 20.00% 54 Missing and 10 partials ⚠️
sei-tendermint/node/node.go 67.56% 27 Missing and 9 partials ⚠️
...i-tendermint/internal/autobahn/producer/mempool.go 81.25% 11 Missing and 4 partials ⚠️
sei-tendermint/internal/autobahn/producer/state.go 76.56% 8 Missing and 7 partials ⚠️
sei-tendermint/internal/rpc/core/status.go 50.00% 7 Missing and 1 partial ⚠️
sei-tendermint/internal/rpc/core/consensus.go 41.66% 4 Missing and 3 partials ⚠️
sei-tendermint/internal/p2p/giga_router.go 45.45% 5 Missing and 1 partial ⚠️
sei-tendermint/internal/rpc/core/dev.go 0.00% 6 Missing ⚠️
...int/cmd/tendermint/commands/gen_autobahn_config.go 0.00% 5 Missing ⚠️
sei-tendermint/internal/rpc/core/env.go 78.26% 5 Missing ⚠️
... and 8 more
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3522      +/-   ##
==========================================
- Coverage   59.05%   58.16%   -0.90%     
==========================================
  Files        2205     2129      -76     
  Lines      182317   173645    -8672     
==========================================
- Hits       107672   100996    -6676     
+ Misses      64945    63669    -1276     
+ Partials     9700     8980     -720     
Flag Coverage Δ
sei-chain-pr 72.49% <59.13%> (?)
sei-db 70.41% <ø> (-0.22%) ⬇️
sei-db-state-db ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
sei-tendermint/abci/types/types.go 68.88% <ø> (ø)
sei-tendermint/config/autobahn.go 47.82% <ø> (+3.82%) ⬆️
...ei-tendermint/internal/autobahn/consensus/state.go 88.19% <ø> (-0.29%) ⬇️
sei-tendermint/internal/autobahn/types/block.go 83.05% <ø> (+0.60%) ⬆️
sei-tendermint/internal/autobahn/types/testonly.go 94.30% <ø> (-0.14%) ⬇️
sei-tendermint/node/seed.go 48.48% <ø> (ø)
sei-tendermint/internal/autobahn/data/state.go 79.89% <95.45%> (+0.91%) ⬆️
sei-tendermint/internal/rpc/core/events.go 65.06% <60.00%> (ø)
sei-tendermint/internal/rpc/core/evidence.go 81.81% <50.00%> (-18.19%) ⬇️
sei-tendermint/internal/rpc/core/blocks.go 64.63% <0.00%> (-0.80%) ⬇️
... and 14 more

... and 116 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread sei-tendermint/internal/rpc/core/status.go Outdated
Comment thread sei-tendermint/internal/autobahn/producer/mempool.go
Comment thread sei-tendermint/internal/autobahn/producer/mempool.go
Comment thread sei-tendermint/internal/autobahn/producer/mempool.go
delete(m.evmNonces, addr)
for _, x := range m.blocks {
delete(x.evmNonces, addr)
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nonce reset misses open block's evmNonces map

Low Severity

When pruneMempool detects a nonce mismatch and resets tracking for an address, it iterates over m.blocks to delete the address from each sealed block's evmNonces. However, m.nextBlock (the currently-open, not-yet-sealed block) is not included in this cleanup. Since m.nextBlock is a separate field and not part of m.blocks, any stale evmNonces entry for the affected address persists in the open block. This inconsistency means the open block carries stale nonce expectations that the sealed blocks were explicitly cleaned of.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 2161b70. Configure here.

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.

There are 3 total unresolved issues (including 1 from previous review).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit a081eb7. Configure here.

go func() { _, _ = env.Mempool.CheckTx(ctx, req.Tx) }()
if giga, ok := env.gigaRouter().Get(); ok {
go func() { _, _ = giga.Mempool().InsertTx(ctx, req.Tx) }()
return &coretypes.ResultBroadcastTx{Hash: req.Tx.Hash().Bytes()}, nil
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BroadcastTxAsync silently drops txs under backpressure

Medium Severity

In the autobahn path of BroadcastTxAsync, InsertTx is launched in a detached goroutine using the HTTP request's ctx. Unlike the old CheckTx (which returned near-instantly), the new InsertTx blocks when the mempool is full. When the handler returns immediately after go func(), the request context is cancelled, causing the blocking InsertTx to fail silently. Under backpressure, transactions submitted via BroadcastTxAsync are effectively dropped instead of queued.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit a081eb7. Configure here.

// Seal the payload if needed.
if toProduce == m.next {
m.PushBlock()
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing ctrl.Updated() after PushBlock in producer loop

Low Severity

When the producer's Run loop seals a partial block via m.PushBlock() after the BlockInterval timeout, no ctrl.Updated() call follows. This means InsertTx callers waiting on !m.IsFull() won't be woken up even though m.nextBlock is now empty (which makes IsFull() false). They remain blocked until the separate pruning goroutine eventually calls Updated() after execution, adding unnecessary latency to transaction insertion.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit a081eb7. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant